local fruitTreeTable = { -- [id] = {transformId, fruitId, fruitCount}
	[2785] = {transformId = 2786, fruitId = 2677, fruitCount = 3}, --- ITEM_BLUEBERRYBUSH
	[5157] = {transformId = 5156, fruitId = 5097, fruitCount = {8, 12}}, --- mango
--	[5391] = {transformId = 5390, fruitId = 2676, fruitCount = {3, 6}}, --- banana ?
	[5096] = {transformId = 2726, fruitId = 2678, fruitCount = {3, 5}}, --- coconut
	[4006] = {transformId = 4008, fruitId = 2675, fruitCount = {8, 10}}, --- orange
	
	[2703] = {fruitId = 8839, fruitCount = {1, 4}, add = true, aid = 103}, --- plum
	[2705] = {fruitId = 2673, fruitCount = 1, add = true, aid = 103}, --- pear
	[2704] = {fruitId = 2674, fruitCount = 1, add = true, aid = 103} --- apple
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local FRUITS, count = nil, 0
	FRUITS = fruitTreeTable[item.itemid]
	
	if FRUITS.aid ~= nil and item.actionid ~= FRUITS.aid then
		doPlayerSendCancel(cid, 'You cannot use this tree.')
		return false
	end

	if FRUITS.transformId ~= nil then
		doTransformItem(item.uid, FRUITS.transformId)
		doDecayItem(item.uid)
	end
	
	count = type(FRUITS.fruitCount) == "table" and math.random(FRUITS.fruitCount[1], FRUITS.fruitCount[2]) or FRUITS.fruitCount
	
	if FRUITS.add then
		doPlayerAddItem(cid, FRUITS.fruitId, count, true)
	else
		doCreateItem(FRUITS.fruitId, count, fromPosition)
	end
	
	--[[
	if type(FRUITS.fruitCount) == "table" then
		if FRUITS.add then
			doPlayerAddItem(cid, FRUITS.fruitId, math.random(FRUITS.fruitCount[1], FRUITS.fruitCount[2]), true)
		else
			doCreateItem(FRUITS.fruitId, math.random(FRUITS.fruitCount[1], FRUITS.fruitCount[2]), fromPosition)
		end
	else
		if FRUITS.add then
			doPlayerAddItem(cid, FRUITS.fruitId, FRUITS.fruitCount, true)
		else
			doCreateItem(FRUITS.fruitId, FRUITS.fruitCount, fromPosition)
		end
	end
	]]
	return true
end

--[[
	<item id="4007" article="a" name="thread tree"/>
	<item id="5092" article="a" name="banana tree"/>
	<item id="5093" article="a" name="banana tree"/>
	<item id="5094" article="a" name="banana tree"/>
	<item id="5095" article="a" name="banana tree"/>
]]